package com.message.api.user.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.message.api.user.entity.AcUser;
import com.message.api.user.vo.AcUserVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author mzl
 * @since 2020-07-09
 */
public interface AcUserMapper extends BaseMapper<AcUser> {

    /**
     * 根据账号获取用户信息
     *
     * @param username
     * @return
     */
    AcUser findByUsername(@Param("username") String username);

    /**
     * 根据教工号获取用户信息
     *
     * @param teacherNumber
     * @return
     */
    AcUser findByTeacherNumber(@Param("teacherNumber")String teacherNumber);

    /**
     * 条件查询
     *
     * @param queryWrapper
     * @return
     */
    List<AcUserVo> findByExample(@Param(Constants.WRAPPER) QueryWrapper<AcUserVo> queryWrapper);

    /**
     * 条件查询
     *
     * @param page
     * @param queryWrapper
     * @return
     */
    List<AcUserVo> findByExample(@Param(Constants.WRAPPER) QueryWrapper<AcUserVo> queryWrapper, Page page);

    /**
     * 根据重置令牌获取对象
     *
     * @param resettoken
     * @return
     */
    AcUser findByResettoken(@Param("resettoken") String resettoken);

    /**
     * 角色id和部门id
     * @param acGroup
     * @param departmentId
     * @return
     */
    List<AcUser> selectByAcGroupAndDepartmentId(@Param("acGroup")Integer acGroup, @Param("departmentId")Integer departmentId);
}
